package org.domain.sigepac.Entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@Entity
@Table(name="tb_visita_avaliacoes")
public class ItensVisita extends EntidadeAbstrata {

	private static final long serialVersionUID = -2668182497115320690L;

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;


	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_visita", referencedColumnName = "id", nullable = false)
	private Visita visita;

	@Enumerated(EnumType.ORDINAL)
	@Column(name="aspecto",nullable=false)
	private AspectosVisita aspecto;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((aspecto == null) ? 0 : aspecto.hashCode());
		result = prime * result
				+ ((avaliacao == null) ? 0 : avaliacao.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((visita == null) ? 0 : visita.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		ItensVisita other = (ItensVisita) obj;
		if (aspecto != other.aspecto)
			return false;
		if (avaliacao == null) {
			if (other.avaliacao != null)
				return false;
		} else if (!avaliacao.equals(other.avaliacao))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (visita == null) {
			if (other.visita != null)
				return false;
		} else if (!visita.equals(other.visita))
			return false;
		return true;
	}


	@Column(name="avaliacao",nullable=false,length=5000)
	private String avaliacao;


	public Serializable getId() {
		return id;
	}


	public Visita getVisita() {
		return visita;
	}


	public void setVisita(Visita visita) {
		this.visita = visita;
	}


	public AspectosVisita getAspecto() {
		return aspecto;
	}


	public void setAspecto(AspectosVisita aspecto) {
		this.aspecto = aspecto;
	}


	public String getAvaliacao() {
		return avaliacao;
	}


	public void setAvaliacao(String avaliacao) {
		this.avaliacao = avaliacao;
	}




}
